import React from 'react'
import { Form, Input, Select, Button } from 'antd';

const layout = {
    labelCol: { span: 9 },
    wrapperCol: { span: 7 },
};
const validateMessages = {
    required: '${label}不能为空!'
};
class BasicInfo extends React.Component{
    constructor() {
        super();
        this.adminName = React.createRef();
        this.adminPwd = React.createRef();
        this.createName = React.createRef();
    };
    //向父组件发送表单信息
    sendBasicInfo=()=>{
        let basicInfo = {
            adminName:this.adminName.current.state.value,
            adminPwd:this.adminPwd.current.state.value,
            createName:this.createName.current.state.value
        };
        return basicInfo
    }
    render() {
        return (
            <>
                <Form {...layout} name="nest-messages" onFinish={this.onFinish} validateMessages={validateMessages}>
                    <Form.Item name={['user', 'name']} label="用户名" rules={[{ required: true }]}>
                        <Input ref={this.adminName}/>
                    </Form.Item>
                    <Form.Item name={['user', 'pwd']} label="密码" rules={[{ required: true }]}>
                        <Input ref={this.adminPwd} type='password'/>
                    </Form.Item>
                    <Form.Item name={['user', 'createName']} label="姓名" rules={[{ required: true }]}>
                        <Input ref={this.createName} />
                    </Form.Item>
                    <Form.Item name={['user', 'shopId']} label="状态" rules={[{ required: true }]}>
                        <Select>
                            <Select.Option value="0" selected='selected'>启用</Select.Option>
                            <Select.Option value="1" disabled='true'>禁用</Select.Option>
                        </Select>
                    </Form.Item>
                </Form>
            </>
        );
    }
}

export default BasicInfo
